// 封装请求
import axios from "axios";
// import {initStorage} from '@/utils/tools'

//如果用代理 baseURL 填  "/api"
const http = axios.create({
  baseURL: "/",
  timeout: 6000,
});

// const token = initStorage('token')
// 请求拦截
http.interceptors.request.use(
  (config) => {
    // config.headers = {
    //     'X-Access-Token': token
    // }
    return config;
  },
  (err) => {
    console.log(err);
  }
);

http.interceptors.response.use(
  (arr) => {
    return arr.data;
  },
  (err) => {
    console.log(err);
  }
);
// 返出
export default http;
